package ms.maplestory.boot.service.jobs.resistance;

import ms.maplestory.boot.client.character.Char;
import ms.maplestory.boot.enums.JobType;
import ms.maplestory.boot.service.jobs.Job;
import ms.maplestory.boot.service.jobs.JobService;
import org.springframework.stereotype.Service;

@Job(JobType.Citizen)
@Service
public class CitizenService extends JobService {

    public static final int CRYSTAL_THROW = 30001000; // 水晶投掷
    public static final int INFILTRATE = 30001001; // 潜入
    public static final int POTION_MASTERY = 30000002; // 效率提升

    private int[] addedSkills = new int[]{
            CRYSTAL_THROW,
            INFILTRATE,
            POTION_MASTERY
    };

    @Override
    public void init(Char chr) {
        super.init(chr);
        if (chr.getId() != 0 && isHandlerOfJob(chr.getStat().getJob())) {
            for (int id : addedSkills) {
//                if (!chr.hasSkill(id)) {
//                    Skill skill = SkillData.getSkillDeepCopyById(id);
//                    skill.setRootId(3000);
//                    skill.setMasterLevel(3);
//                    skill.setMaxLevel(3);
//                    skill.setChr(chr);
//                    skillRepository.save(skill);
//                    chr.getSkills().add(skill);
//                }
            }
        }
    }

    @Override
    public void initCharCreationStats(Char chr) {
        super.initCharCreationStats(chr);
        chr.getStat().setPosMap(931000000);
        charStatRepository.save(chr.getStat());
    }

    @Override
    public boolean isHandlerOfJob(int id) {
        return id == JobType.Citizen.getId();
    }
}
